<!DOCTYPE html>
<html lang="en" class="no-js" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="layout">
<head>
<title>积分商品管理</title>
</head>
<body>
<div layout:fragment="content">
	<div class="row">
		<div class="col-md-12">
			<div class="btn-group pull-right">
				<a href="index.html" th:href="@{/creditGoods/list/}" id="sample_editable_1_new" class="btn green">返回<i class="fa fa-arrow-circle-o-left"></i></a>
			</div>
		</div>
	</div>
	<div class="row">
		<div class="col-md-12">
			<h4 class="form-section">积分商品信息</h4>
				<div class="form-group">
					<label class="control-label col-md-3">商品货号<span class="required" aria-required="true">* </span></label>							
					<div class="col-md-4">
						<input id="goodsSn" name="goodsSn" type="text" class="form-control" placeholder="商品货号"/>
					</div>
				</div>
				<div class="form-actions fluid">
					<div class="col-md-offset-3 col-md-9">
						<button type="button" id="btn_search" class="btn blue">搜索</button>
					</div>
				</div>
			
				<form role="form" id="form" th:action="@{/creditGoods/save}" th:object="${creditGoods}" method="post" class="form-horizontal">
					<input type="hidden" th:field="*{id}" />
					<div class="form-group">
						<label class="control-label col-md-3">商品</label>
						<div class="col-md-4">
				            <select id="selt_goodsType" th:field="*{goodsId}" th:remove="all-but-first" class="form-control">
				                <option th:each="eachValue : ${goodsList}" th:value="${eachValue.id}" th:text="${eachValue.name}"></option>
				            </select>													
						</div>
					</div>
					<div class="form-body">
						<div class="form-group">
							<label class="control-label col-md-3">类型<span class="required" aria-required="true">* </span></label>
							<div class="col-md-9">
								<div class="radio-list"> 
								<label class="radio-inline" th:each="eachValue : ${type}"> 
								<span>
								<input th:field="*{type}" type="radio" name="type" th:value="${eachValue}" th:text="${eachValue.description}" id="credit_goods_type" />
								</span>
								</label>
								</div>
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('limitNumber')}? 'has-error'">
							<label class="control-label col-md-3">限购数量<span class="required">* </span></label>							
							<div class="col-md-4">
								<input type="text" class="form-control" placeholder="限购数量" th:field="*{limitNumber}"/>
								<span class="help-block" th:if="${#fields.hasErrors('limitNumber')}" th:errors="*{limitNumber}"></span>
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('credit')}? 'has-error'">
							<label class="control-label col-md-3">积分值<span class="required">* </span></label>							
							<div class="col-md-4">
								<input type="text" class="form-control" placeholder="积分值" th:field="*{credit}"/>
								<span class="help-block" th:if="${#fields.hasErrors('credit')}" th:errors="*{credit}"></span>
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('money')}? 'has-error'">
							<label class="control-label col-md-3">现金<span class="required">* </span></label>							
							<div class="col-md-4">
								<input type="text" class="form-control" placeholder="现金" th:field="*{money}"/>
								<span class="help-block" th:if="${#fields.hasErrors('money')}" th:errors="*{money}"></span>
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('startTime')}? 'has-error'">
							<label class="control-label col-md-3">开始时间<span class="required">* </span></label>							
							<div class="col-md-4">
								<input id="start_time" type="text" class="form-control" placeholder="开始时间" th:field="*{startTime}"/>
								<span class="help-block" th:if="${#fields.hasErrors('startTime')}" th:errors="*{startTime}"></span>
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('endTime')}? 'has-error'">
							<label class="control-label col-md-3">结束时间<span class="required">* </span></label>							
							<div class="col-md-4">
								<input id="end_time" type="text" class="form-control" placeholder="结束时间" th:field="*{endTime}"/>
								<span class="help-block" th:if="${#fields.hasErrors('endTime')}" th:errors="*{endTime}"></span>
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('isExchange')}? 'has-error'">
							<label class="control-label col-md-3">是否可兑换<span class="required">* </span></label>							
							<div class="col-md-4">
								<div class="radio-list">
									<label class="radio-inline"><span><input type="radio" name="type"  id="optionsRadios4" value="1" checked="" th:field="*{isExchange}" /></span> 是</label>
									<label class="radio-inline"><span><input type="radio" name="type" id="optionsRadios5" value="2" th:field="*{isExchange}" /></span> 否</label>
								</div>						
							</div>
						</div>
						<div class="form-group" th:classappend="${#fields.hasErrors('isHot')}? 'has-error'">
							<label class="control-label col-md-3">是否热销<span class="required">* </span></label>							
							<div class="col-md-4">
								<div class="radio-list">
									<label class="radio-inline"><span><input type="radio" name="type"  id="optionsRadios4" value="1" checked="" th:field="*{isHot}" /></span> 是</label>
									<label class="radio-inline"><span><input type="radio" name="type" id="optionsRadios5" value="2" th:field="*{isHot}" /></span> 否</label>
								</div>						
							</div>
						</div>
					</div>	
					<div class="form-actions fluid">
						<div class="col-md-offset-3 col-md-9">
							<button type="submit" id="btn_submit" class="btn blue">提交</button>
						</div>
					</div>
				</form>		
			</div>
		</div>
	</div>
</body>
</html>
<script th:inline="javascript">
	/*<![CDATA[*/
		$("#start_time").click(function(){
			WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
		}).focus(function () {
            WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
        });
		$("#end_time").click(function(){
			WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
		}).focus(function () {
            WdatePicker({startDate:'%y-%M-01 00:00:00',dateFmt:'yyyy-MM-dd HH:mm:ss',alwaysUseStartDate:true,readOnly:true});
        });
	          
		$('#btn_search').click(function() {
			var _sn = $('#goodsSn').val();
    		BOSS.remoteCall('creditGoods/ajaxSearch',$('#selt_goodsType'),{goodsSn:_sn});
		});
	/*]]>*/
</script>